﻿using FB.Providers.EmployeeInfo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace FB.Providers
{
    public static class CompanyManager
    {
       
        public static EmployeeInfoUnit EmployeeInfoUnit
        {
            get
            {
                var EF = AspNetEmployeeInfoProviderManager.Default as EFEmployeeInfoProvider;
                if (null != EF)
                {
                    return  EF.GetEmployeeInfoUnit();
                }
                return null;
            }
        }
        
        //#region company 公司
        //public static Company GetCompany(string COMCode)
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    return infounit.CompanyRepository.GetByKey(COMCode);
        //}

        //public static List<Company> GetAllCompanies()
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    return infounit.CompanyRepository.Get().ToList();
          
        //}

        //public static List<Company> FindCompanies(Expression<Func<Company, bool>> filter = null,Func<IQueryable<Company>, IOrderedQueryable<Company>> orderBy = null,
        //    string includeProperties = "")
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    return infounit.CompanyRepository.Get(filter, orderBy, includeProperties).ToList();
        //}

        //public static Company CreateCompany(Company company)
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    Company comp = infounit.CompanyRepository.Insert(company);
        //    infounit.SaveChanges();
        //    return comp;
        //}

        //public static void UpdateCompany(Company company)
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    infounit.CompanyRepository.Update(company);
        //    infounit.CompanyRepository.SaveChanges();
           
        //}

        //public static void DeleteCompany(string COMCode)
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    infounit.CompanyRepository.Delete(COMCode);
        //    infounit.CompanyRepository.SaveChanges();
        //}


        //public static List<Company> FindCompanies(
        // Expression<Func<Company, bool>> filter,
        // Func<IQueryable<Company>, IOrderedQueryable<Company>> orderBy,
        // int pageIndex, int pageSize, out int totalRecords)
        //{
        //    EmployeeInfoUnit infounit = EmployeeInfoUnit;
        //    return infounit.CompanyRepository.GetPagedList(filter, orderBy, pageIndex, pageSize, out totalRecords).ToList();
        
        //}
     
        //#endregion 

         
         
    }
}
